package demo9_huffmantree;

public class Node implements Comparable<Node>{
    int value;
    Node left;
    Node right;

    public Node(int value){
        this.value = value;
    }
    public void frontShow() {
        System.out.println(value);
        //左节点
        if (left!=null){
            left.frontShow();
        }
        //右节点
        if (right!=null){
            right.frontShow();
        }

    }

    @Override
    public int compareTo(Node o) {
        return this.value-o.value;
    }

    @Override
    public String toString() {
        return "Node{" +
                "value=" + value +
                ", left=" + left +
                ", right=" + right +
                '}';
    }
}
